import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.ArrayList;


public class RISC {
	
	BufferedReader in;
	ObjectOutput obj_out;
	PrintWriter out;
	
	public RISC() {
		
	}
	
	public synchronized void getOrders() {
		
	}
	
	public void SendText(String s, Socket sock) throws IOException {
		out = new PrintWriter(sock.getOutputStream(), true);
		out.println(s);
	}
	
	public void SendOrderList(ArrayList<Order> list, Socket sock) throws IOException
	{
		obj_out = new ObjectOutputStream(sock.getOutputStream());
		obj_out.writeObject(list);
	}
	
	@SuppressWarnings("unchecked") //unsuppress this when I figure out why
	public ArrayList<Territory> GetTerritoryList(Socket sock) throws IOException, ClassNotFoundException
	{
		ObjectInputStream obj_in = new ObjectInputStream(sock.getInputStream());
		return (ArrayList<Territory>) obj_in.readObject();
	}
	
	public String GetText(Socket sock) throws IOException {
		in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
		return in.readLine(); //may need to change this to read more than one line
	}
}
